package com.marsoft.test.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.marsoft.test.entity.SecuredLoanInfoEntity;
import com.marsoft.test.entity.SecuredTransitBusinessEntity;
import com.marsoft.test.mapper.SecuredMapper;
import com.marsoft.test.service.SecuredService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author FAN_c
 * @date 2021/5/20 17:35
 * @description
 */

@Service
@Transactional
public class SecuredServiceImpl implements SecuredService {

    @Autowired
    private SecuredMapper securedMapper;

    /**
     * 被担保的贷款信息
     * @return
     */
    @Override
    public List<SecuredLoanInfoEntity> findAllSecuredLoanInfo() {

        SecuredLoanInfoEntity securedLoanInfoEntity = new SecuredLoanInfoEntity();
        //分页起始码以及每页页数
        PageHelper.startPage(1,10);
        List<SecuredLoanInfoEntity> allSecuredLoanInfo = securedMapper.findAllSecuredLoanInfo();
        PageInfo pageInfo = new PageInfo(allSecuredLoanInfo);
        return pageInfo.getList();
    }

    /**
     * 被担保的在途业务
     * @return
     */
    @Override
    public List<SecuredTransitBusinessEntity> findSecuredTransitBusiness() {
        SecuredTransitBusinessEntity securedTransitBusinessEntity = new SecuredTransitBusinessEntity();

        //分页起始码以及每页页数
        PageHelper.startPage(1,10);
        List<SecuredTransitBusinessEntity> securedTransitBusiness = securedMapper.findSecuredTransitBusiness();

        PageInfo pageInfo = new PageInfo(securedTransitBusiness);

        return pageInfo.getList();
    }
}
